<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta http-equiv="X-UA-Compatible" content="IE=edge" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>Document</title>
  </head>
  <body></body>
  <script>
    var merge = function (nums1, m, nums2, n) {
      let arr1 = nums1.slice(0, m);
      let arr2 = nums2.slice(0, n);
      let arr3 = [...arr1, ...arr2];
      let arr4 = arr3.sort();
      console.log("arr4", arr4);
      return arr4;
    };
    merge([1, 2, 3, 0, 0, 0], 3, [2, 5, 6], 3);
  </script>
</html>
